﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace DMSClient
{
    public partial class Store : Form
    {
        public Store()
        {
            InitializeComponent();
        }

        private void iBtnDistributor_Click(object sender, EventArgs e)
        {
            try
            {
                StoreServices.IStoreClient StoreSrv = new DMSClient.StoreServices.IStoreClient();
                iGrvStore.DataSource = StoreSrv.StoreByDistributor("RABIE");
                iGrvStore.DataBind();
                FormatiGrvStore();
            }
            catch (Exception)
            {
                throw;
            }
        }

        private void FormatiGrvStore()
        {
            iGrvStore.DisplayLayout.Override.AllowRowFiltering = Infragistics.Win.DefaultableBoolean.True;
            iGrvStore.DisplayLayout.GroupByBox.Prompt = "Arrastra aquí alguna cabecera para agrupar por ella";
            iGrvStore.DisplayLayout.Override.RowSelectorHeaderStyle = Infragistics.Win.UltraWinGrid.RowSelectorHeaderStyle.ColumnChooserButton;
            iGrvStore.DisplayLayout.Override.RowSelectors = Infragistics.Win.DefaultableBoolean.True;

            iGrvStore.DisplayLayout.Bands[0].Columns["cdCity"].Hidden = true;
            iGrvStore.DisplayLayout.Bands[0].Columns["cdCity"].Header.Caption = "cdCity";

            iGrvStore.DisplayLayout.Bands[0].Columns["cdClass1"].Hidden = true;
            iGrvStore.DisplayLayout.Bands[0].Columns["cdClass1"].Header.Caption = "cdClass1";

            iGrvStore.DisplayLayout.Bands[0].Columns["cdClass2"].Hidden = true;
            iGrvStore.DisplayLayout.Bands[0].Columns["cdClass2"].Header.Caption = "cdClass2";

            iGrvStore.DisplayLayout.Bands[0].Columns["cdRegion"].Hidden = true;
            iGrvStore.DisplayLayout.Bands[0].Columns["cdRegion"].Header.Caption = "cdRegion";

            iGrvStore.DisplayLayout.Bands[0].Columns["cdStatus"].Hidden = true;
            iGrvStore.DisplayLayout.Bands[0].Columns["cdStatus"].Header.Caption = "cdStatus";

            iGrvStore.DisplayLayout.Bands[0].Columns["cdStore"].Hidden = true;
            iGrvStore.DisplayLayout.Bands[0].Columns["cdStore"].Header.Caption = "cdStore";

            iGrvStore.DisplayLayout.Bands[0].Columns["cdStoreBrand"].Hidden = true;
            iGrvStore.DisplayLayout.Bands[0].Columns["cdStoreBrand"].Header.Caption = "cdStoreBrand";

            iGrvStore.DisplayLayout.Bands[0].Columns["dsAddressComplement"].Hidden = true;
            iGrvStore.DisplayLayout.Bands[0].Columns["dsAddressComplement"].Header.Caption = "dsAddressComplement";

            iGrvStore.DisplayLayout.Bands[0].Columns["dsName"].Hidden = true;
            iGrvStore.DisplayLayout.Bands[0].Columns["dsName"].Header.Caption = "dsName";

            iGrvStore.DisplayLayout.Bands[0].Columns["nmAddress"].Hidden = true;
            iGrvStore.DisplayLayout.Bands[0].Columns["nmAddress"].Header.Caption = "nmAddress";

            iGrvStore.DisplayLayout.Bands[0].Columns["nmNeighborhood"].Hidden = true;
            iGrvStore.DisplayLayout.Bands[0].Columns["nmNeighborhood"].Header.Caption = "nmNeighborhood";

            iGrvStore.DisplayLayout.Bands[0].Columns["nrZipCode"].Hidden = true;
            iGrvStore.DisplayLayout.Bands[0].Columns["nrZipCode"].Header.Caption = "nrZipCode";
        } 
    }
}
